package com.qriver.cloud.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

@EnableBinding(Source.class)
@Component
public class SendMsgService {

    private MessageChannel output;

    @Autowired
    public SendMsgService(MessageChannel output) {
        this.output = output;
    }

    public void sendMsg(String name) {
        output.send(MessageBuilder.withPayload(name).build());
    }

}
